package com.support;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import android.content.Context;
import android.os.Bundle;
import android.widget.ImageView;

import com.base.mybaseproject.base.AppHelper;
import com.base.mybaseproject.base.BaseActivity;
import com.base.mybaseproject.base.BaseAsyncTask;
import com.base.mybaseproject.base.Constant;
import com.base.mybaseproject.http.HttpUtils;
import com.example.mybaseproject.R;

public class MainActivity extends BaseActivity {
	ImageView iv;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		iv = (ImageView) findViewById(R.id.main_iv);
		AppHelper.newInstance().imageLoder.get(Constant.URL + "/uploads/image/20130723/20130723181823_90060.png", iv);
		new DemoAsync(this).execute();

	}

	class DemoAsync extends BaseAsyncTask {

		protected DemoAsync(Context context) {
			super(context);
		}

		@Override
		protected JSONObject doInBackground(Object... params) {
			List<NameValuePair> list = new ArrayList<NameValuePair>();// 组件参数
			list.add(new BasicNameValuePair("knowdetails_type", "shipu"));
			list.add(new BasicNameValuePair("pageNum", "1"));
			list.add(new BasicNameValuePair("pageSize", "100"));
			return HttpUtils.post("/know/allknow", list);
		}

		@Override
		protected void onPostExecute(JSONObject result) {
			super.onPostExecute(result);
			if (result != null) {
				Utils.showToast(MainActivity.this, "success");
			}
		}

	}
}
